<?php
namespace WebApper\Shortcode;

/*
 * [services]
 *
 */
 class ServiceBox extends \WebApper\Shortcode {
	
    /**
     * Define shortcode properties
     *
     */
	protected $shortcode = 'services';
    
    /**
     * Handles the add post shortcode
     *
     * @param array $atts
     */
	 
    public function shortcode( $atts ) {

		global $wpdb, $webapper, $current_user;//, $wp_roles;	
		//$roles = $wp_roles->get_names();
		//print_r($roles)	;			
		?>
		<?php
				//INSERT SERVICE
				$durationList=array(15=>MIN15,30=>MIN30,45=>MIN45,60=>H1,120=>H2,180=>H3,240=>H4,300=>H5,360=>H6,420=>H7,480=>H8,540=>H9,600=>H10,660=>H11,720=>H12);
				$id = (!empty($_REQUEST["id"])) ?  $_REQUEST["id"] : '';
    			$serviceName = (!empty($_REQUEST["serviceName"])) ? $_REQUEST["serviceName"] : '';		
				$interval = (!empty($_REQUEST["interval"])) ? $_REQUEST["interval"] : '15';
				$maxSeat = (!empty($_REQUEST["maxSeats"])) ? $_REQUEST["maxSeats"] : '0';
				$minSeat =  (!empty($_REQUEST["minSeats"])) ? $_REQUEST["minSeats"] : '0';
				$fillSeatsBefore = (!empty($_REQUEST["fillSeatsBefore"])) ? $_REQUEST["fillSeatsBefore"] : '0';
				$confirmSeatsBefore = (!empty($_REQUEST["confirmSeatsBefore"])) ? $_REQUEST["confirmSeatsBefore"] : '0';
				$confirmSeatsWithin = (!empty($_REQUEST["confirmSeatsWithin"])) ? $_REQUEST["confirmSeatsWithin"] : '0';
				$autoconfirm= (!empty($_REQUEST["autoconfirm"])) ? $_REQUEST["autoconfirm"] : '0';				
				$formShortcode = (!empty($_REQUEST["formShortcode"])) ? $_REQUEST["formShortcode"] : '';
				$clientConfirmEmail = (isset($_REQUEST["clientConfirmEmail"])) ? $_REQUEST["clientConfirmEmail"] : '';
				$clientAutoConfirmEmail = (isset($_REQUEST["clientAutoConfirmEmail"])) ? $_REQUEST["clientAutoConfirmEmail"] : '';
				$clientCancelationEmail = (isset($_REQUEST["clientCancelationEmail"])) ? $_REQUEST["clientAutoConfirmEmail"] : '';
				$agentConfirmedEmail = (isset($_REQUEST["agentConfirmedEmail"])) ? $_REQUEST["agentConfirmedEmail"] : '';
				$agentCancellationEmail = (isset($_REQUEST["agentCancellationEmail"])) ? $_REQUEST["agentCancellationEmail"] : '';
				$adminConfirmedEmail = (isset($_REQUEST["adminConfirmedEmail"])) ? $_REQUEST["adminConfirmedEmail"] : '';
				$adminCancellationEmail = (isset($_REQUEST["adminCancellationEmail"])) ? $_REQUEST["adminCancellationEmail"] : '';				
				$maxHost = (isset($_REQUEST["maxHost"])) ? $_REQUEST["maxHost"] : '1';
				$serviceCapability = (isset($_REQUEST["serviceCapability"])) ? 'booking_'.$_REQUEST["serviceCapability"] : '';				
				$currentDate = date('Y-m-d H:i:s');
				$role = get_role('administrator');
				$capabilityArry = $role->capabilities;
				$capExist = false;
				
				 if (!empty($_REQUEST["edit_page"]) && $_REQUEST["edit_page"] == "yes" && empty($id)) {
						if (!empty($serviceName) && !empty($maxSeat)&& !empty($minSeat)&& !empty($interval)) {
														
							foreach($capabilityArry as $key=>$val)
							{
								if( $key == $serviceCapability)
								{
									$capExist = true;
								}
							}
							if(!$capExist)
							{
								 $role->add_cap( $serviceCapability ); 
							}
							else
							{
								echo "Capability already exist. Try again!";
								return false;
							}
									//Save the Service, Get the service id								
									$id = web_apper_insert_services( $serviceName, $interval, $maxSeat, $minSeat, $fillSeatsBefore, $confirmSeatsBefore, $confirmSeatsWithin, $autoconfirm, $formShortcode, $clientConfirmEmail,$clientAutoConfirmEmail, $clientCancelationEmail, $agentConfirmedEmail, $agentCancellationEmail, $adminConfirmedEmail, $adminCancellationEmail, $maxHost, $serviceCapability);								
																
									for ($i = 0; $i < 7; $i++) {
										$week_from_h = (!empty($_REQUEST["week_from_h_" . $i]) && is_array($_REQUEST["week_from_h_" . $i])) ? ($_REQUEST["week_from_h_" . $i]) : '';
										$week_from_m = (!empty($_REQUEST["week_from_m_" . $i]) && is_array($_REQUEST["week_from_m_" . $i])) ? $_REQUEST["week_from_m_" . $i] : '';
										$week_to_h = (!empty($_REQUEST["week_to_h_" . $i]) && is_array($_REQUEST["week_to_h_" . $i])) ? ($_REQUEST["week_to_h_" . $i]) : '';
										$week_to_m = (!empty($_REQUEST["week_to_m_" . $i]) && is_array($_REQUEST["week_to_m_" . $i])) ? $_REQUEST["week_to_m_" . $i] : '';
										for ($j = 0; $j < count($week_from_h); $j++) {
											if (is_numeric($week_from_h[$j]) && is_numeric($week_from_m[$j]) && is_numeric($week_to_h[$j]) && is_numeric($week_to_m[$j])) {													
												if($week_from_h[$j] == 0){$week_from_h[$j]=24;} # track to output
												if($week_to_h[$j] == 0){$week_to_h[$j]=24;}
												
												$startTime = $week_from_h[$j]*60 + $week_from_m[$j];
												$endTime = $week_to_h[$j]*60 + $week_to_m[$j];
												//Save Service Schedule Time
												$retult = web_apper_services_schedule($id, $i, $startTime, $endTime );																																			
											}
										}
									}
									// addMessage(MSG_SRVSAVE,"success");
								
							
						} else {
							
							 //addMessage(ALLFIELDSREQ);
						}
    			}
			?>

<div class="row-fluid">
  <?php if(isset($_REQUEST['id'])){ ?>
  <h3> Edit Services </h3>
  <?php } else { ?>
  <h3> Add Services </h3>
  <?php }  ?>
  <form class="form-horizontal" action="" enctype="multipart/form-data" method="post" name="ff1">
    <div class="control-group">
      <label class="control-label" for="serviceName">Service Name</label>
      <div class="controls">
        <input type="text" id="serviceName" required="required" name="serviceName" placeholder="Service Name">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" >Duration</label>
      <div class="controls">
        <select name="interval" class="selectpicker" onchange="updateDuration(this)" data-live-search="true" data-size="5">
          <option value="15" <?php echo $interval == "15" ? "selected" : "" ?> rel="<?php echo MIN15 ?>"><?php echo MIN15 ?></option>
          <option value="30" <?php echo $interval == "30" ? "selected" : "" ?> rel="<?php echo MIN30 ?>"><?php echo MIN30 ?></option>
          <option value="45" <?php echo $interval == "45" ? "selected" : "" ?> rel="<?php echo MIN45 ?>"><?php echo MIN45 ?></option>
          <!-- 45 minutes interval causing wrong display of manual bookings by admin. use at your own discretion -->
          <option value="60" <?php echo $interval == "60" ? "selected" : "" ?> rel="<?php echo H1 ?>"><?php echo H1 ?></option>
          <option value="120" <?php echo $interval == "120" ? "selected" : "" ?> rel="<?php echo H2 ?>"><?php echo H2 ?></option>
          <option value="180" <?php echo $interval == "180" ? "selected" : "" ?> rel="<?php echo H3 ?>"><?php echo H3 ?></option>
          <option value="240" <?php echo $interval == "240" ? "selected" : "" ?> rel="<?php echo H4 ?>"><?php echo H4 ?></option>
          <option value="300" <?php echo $interval == "300" ? "selected" : "" ?> rel="<?php echo H5 ?>"><?php echo H5 ?></option>
          <option value="360" <?php echo $interval == "360" ? "selected" : "" ?> rel="<?php echo H6 ?>"><?php echo H6 ?></option>
          <option value="420" <?php echo $interval == "420" ? "selected" : "" ?> rel="<?php echo H7 ?>"><?php echo H7 ?></option>
          <option value="480" <?php echo $interval == "480" ? "selected" : "" ?> rel="<?php echo H8 ?>"><?php echo H8 ?></option>
          <option value="540" <?php echo $interval == "540" ? "selected" : "" ?> rel="<?php echo H9 ?>"><?php echo H9 ?></option>
          <option value="600" <?php echo $interval == "600" ? "selected" : "" ?> rel="<?php echo H10 ?>"><?php echo H10 ?></option>
          <option value="660" <?php echo $interval == "660" ? "selected" : "" ?> rel="<?php echo H11 ?>"><?php echo H11 ?></option>
          <option value="720" <?php echo $interval == "720" ? "selected" : "" ?> rel="<?php echo H12 ?>"><?php echo H12 ?></option>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="maxHost">Max Host</label>
      <div class="controls">
        <select name="maxHost" class="selectpicker"  data-live-search="true" data-size="5">
          <?php 
		     for($i=1; $i<=20; $i++){
				echo "<option value=".$i.">".$i."</option>";
			 }
		 ?>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="maxSeats">Max Seats</label>
      <div class="controls">
        <select name="maxSeats" class="selectpicker"  data-live-search="true" data-size="5">
          <?php 
		     for($i=1; $i<=50; $i++){
				echo "<option value=".$i.">".$i."</option>";
			 }
		 ?>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="minSeats">Min Seats</label>
      <div class="controls">
        <select name="minSeats" class="selectpicker"  data-live-search="true" data-size="5">
          <?php 
		     for($i=1; $i<=50; $i++){
				echo "<option value=".$i.">".$i."</option>";
			  }
		  ?>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="fillSeatsBefore">Fill Seats Before</label>
      <div class="controls">
        <select name="fillSeatsBefore" class="selectpicker" data-live-search="true" data-size="5" >
          <?php
			  for($i=1; $i<=72; $i++){
				echo "<option value=".($i*60).">".$i." Hours</option>";
			   }
		 ?>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="confirmSeatsBefore">Confirm Seats Before</label>
      <div class="controls">
        <select name="confirmSeatsBefore" class="selectpicker" data-live-search="true" data-size="5" >
          <?php
			  for($i=1; $i<=72; $i++){
					echo "<option value=".($i*60).">".$i." Hours</option>";
				}
		  ?>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="confirmSeatsWithin">Confirm Seats within</label>
      <div class="controls">
        <select name="confirmSeatsWithin" id="confirmSeatsWithin" class="selectpicker" data-live-search="true" data-size="5" >
          <?php
				for($i=1; $i<=72; $i++){
				  echo "<option value=".($i*60).">".$i." Hours</option>";
				 }
		  ?>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="autoConfirm">Autoconfirm Seats</label>
      <div class="controls">
        <input type="checkbox" name="autoConfirm" id="autoConfirm" />
      </div>
    </div>
    <div class="form-row">
      <h5><?php echo BOOK_MSG_DAY;?></h5>
      <table cellpadding="5px" cellspacing="0" width="600" class="t_availabolity">
        <?php
							for ($i = 0; $i < 7; $i++) {
								$step = $j = 0;
								$step = 15;
								$items = (isset($week[$i]) && (count($week[$i]) > 0)) ? count($week[$i]) : 1;
								?>
        <tr class="<?php echo !($i%2)?"odd":""?>">
          <td align=left valign="center" width="100"><?php echo getWeek($i) ?>&nbsp;</td>
          <td class="availability"><?php for ($j = 0; $j < $items; $j++) { ?>
            <div class="row_a"> <span class="left lh30" ><?php echo TXT_DAY_SRV_FROM?>&nbsp;&nbsp;</span>
              <input type="text" name="week_from_h_<?php echo $i ?>[]" value="<?php if(isset($seArr["{$i}"]["{$j}"])){echo $seArr["{$i}"]["{$j}"][0];}else{ echo '  - -' ;} ?>" class="adjStartEnd adj_hrs_0" />
              <span class="left lh30" >&nbsp;:&nbsp;</span>
              <input type="text" name="week_from_m_<?php echo $i ?>[]" value="<?php if(isset($seArr["{$i}"]["{$j}"])){echo $seArr["{$i}"]["{$j}"][1];}else{ echo '  - -' ;} ?>" class="adjStartEnd adj_mins_0" />
              <span class="left lh30" >&nbsp;&nbsp;&nbsp;<?php echo TXT_DAY_SRV_TO?>&nbsp;&nbsp;</span>
              <input type="text" name="week_to_h_<?php echo $i ?>[]" value="<?php if(isset($seArr["{$i}"]["{$j}"])){echo $seArr["{$i}"]["{$j}"][2];}else{ echo '  - -' ;} ?>" class="adjStartEnd adj_hrs_0" />
              <span class="left lh30" >&nbsp;:&nbsp;</span>
              <input type="text" name="week_to_m_<?php echo $i ?>[]" value="<?php if(isset($seArr["{$i}"]["{$j}"])){echo $seArr["{$i}"]["{$j}"][3];}else{ echo '  - -' ;} ?>" class="adjStartEnd adj_mins_0" />
              <?php if($j > 0): ?>
              <a href="#" class="adj_SE_remove" >delete this</a>
              <?php else: ?>
              <a href="#" class="adj_SE_clear" >delete this</a>
              <?php endif;?>
            </div>
            <?php } ?>
            <a href="javascript:;" onclick="addTime(<?php echo $i ?>,this)" class="buttonAddSmall"><span>add</span></a></td>
        </tr>
        <?php } ?>
      </table>
    </div>
    <div class="control-group">
      <label class="control-label" for="serviceCapability">Capability</label>
      <div class="controls">
        <input type="text" name="serviceCapability"  id="serviceCapability" required="required" />
      </div>
    </div>
        
    <div class="control-group">
      <label class="control-label" for="formShortcode">Form Shortcode</label>
      <div class="controls">
        <input type="text" name="formShortcode"  id="formShortcode" required="required" style="width: 469px;" />
      </div>
    </div>
    
    <div class="control-group">
      <label class="control-label" for="clientConfirmEmail">Client Confirm Email</label>
      <div class="controls">
        <textarea name="clientConfirmEmail" id="clientConfirmEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_client_default_confirm_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="clientAutoConfirmEmail">Client Autoconfirm Email</label>
      <div class="controls">
        <textarea name="clientAutoConfirmEmail" id="clientAutoConfirmEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_client_default_auto_confirm_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="clientCancelationEmail">Client Cancellation Email</label>
      <div class="controls">
        <textarea name="clientCancelationEmail" id="clientCancelationEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_client_default_cancellation_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="agentConfirmedEmail">Agent Confirmed Email</label>
      <div class="controls">
        <textarea name="agentConfirmedEmail" id="agentConfirmedEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_staff_default_confirm_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="agentCancellationEmail">Agent Cancellation Email</label>
      <div class="controls">
        <textarea name="agentCancellationEmail" id="agentCancellationEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_staff_default_cancellation_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="adminConfirmedEmail">Admin Confirmed Email</label>
      <div class="controls">
        <textarea name="adminConfirmedEmail" id="adminConfirmedEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_administrator_default_confirm_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="adminCancellationEmail">Admin Cancellation Email</label>
      <div class="controls">
        <textarea name="adminCancellationEmail" id="adminCancellationEmail" rows="3" cols="3" style="width: 469px; height: 133px;" ><?php echo get_administrator_default_cancellation_message(); ?></textarea>
      </div>
    </div>
    <div class="control-group">
      <div class="controls">
        <button type="submit" class="btn btn-primary"><?php echo ADM_BTN_SUBMIT;?></button>
      </div>
    </div>
    <input value="yes" name="edit_page" type="hidden" />
    <input value="<?php echo $id; ?>" name="id" type="hidden" />
  </form>
</div>
<script type="text/javascript">
			  jQuery(document).ready(function($) {
				  $('.selectpicker').selectpicker();
				  if($('.adjStartEnd').length > 0){		
						$.each($('.adjStartEnd'),function(){
							var adj_se_bg = "<span class='adj_se_nav_top'></span><span class='adj_se_nav_bottom'></span>";
							var sehtml = "<div class='adj_se_input_bg' style='width:"+$(this).css("width")+";height:"+$(this).css("height")+";padding:"+$(this).css("padding")+";' >"+adj_se_bg+"</div>";
							var wrapper = "<div class='adj_se' ></div>";
							$(this).wrap(wrapper);
							$(this).parent().append(sehtml);	
						})
						findAndBindSE();
					}
			  });
        function findAndBindSE(){
												
	jQuery('.adj_SE_remove').click(function(){
		jQuery(this).parent().remove();
		return false;
	});
        jQuery('.adj_SE_clear').click(function(){
		jQuery(this).parent().find("input").each(function(){
                    jQuery(this).val(" - -");
                });
		return false;
	});
	jQuery('.adj_se_nav_top').click(function(){
			var value = jQuery(this).parent().prev().val();
			if(jQuery(this).parent().prev().hasClass('adj_mins_0')){
				jQuery(this).parent().prev().val(compareSEvals('mins','plus',value));
			}else if(jQuery(this).parent().prev().hasClass('adj_hrs_0')){
				jQuery(this).parent().prev().attr("value",compareSEvals('hrs','plus',value));
			}else {
				value = parseInt(value);
				newvalue = value + 1;
				if(newvalue < 0){return alert('This value must be a positive integer !');}
				else return  $(this).parent().prev().val(newvalue);
			}		
		});
		jQuery('.adj_se_nav_bottom').click(function(){
			var value = jQuery(this).parent().prev().val();
			if(jQuery(this).parent().prev().hasClass('adj_mins_0')){
				jQuery(this).parent().prev().attr("value",compareSEvals('mins','minus',value));
			}else if(jQuery(this).parent().prev().hasClass('adj_hrs_0')){
				jQuery(this).parent().prev().attr("value",compareSEvals('hrs','minus',value));
			}else {
				value = parseInt(value);
				newvalue = value - 1;
				if(newvalue < 0){return alert('This value must be a positive integer !');}
				else return $(this).parent().prev().val(newvalue);
			}	
		});
		/*$('.adjStartEnd').mouseover(function(){
			if($(this).val() == '  - -'){
				$(this).val('');
			}
		});
		$('.adjStartEnd').mouseout(function(){
			if($(this).val() == ''){
				$(this).val('  - -');
			}
		});*/
                jQuery('.adjStartEnd').click(function(){
			if(jQuery(this).val() == '  - -'){
				jQuery(this).val('');
			}
		});
                jQuery('.adjStartEnd').focus(function(){
			if(jQuery(this).val() == '  - -'){
				jQuery(this).val('');
			}
		});
		jQuery('.adjStartEnd').keypress(function(event){
                     var self = this;	 
                        function handle() {
                            var value = jQuery(self).val();
                            if(String.fromCharCode(event.which) == 'N'){
                                    jQuery.each(jQuery(self).parent().parent().children('.adj_se').children('input'),function(){
										jQuery(self).val('N/A');
                                            //$(self).css("background","#000");
                                    });
                                    return false;
                            }
                            value-=0;
                            var str = value.toString(); 

                            if(str.length > 2){

                                value = parseInt(str.substr(1,2));

                                jQuery(self).val( value);
                            }

                            if(!(!isNaN(parseFloat(value)) && isFinite(value))){jQuery(self).val('00'); if(value != '  - -'){return alert('Please Insert only Numeric value! !');}}
                            value = parseInt(value-0);
                            if(jQuery(self).hasClass('adj_hrs_0') && value > 23 || value < 0 ){jQuery(self).val('00');return alert('Please Insert values for Hours only between 00 and 23!');}
                            if(jQuery(self).hasClass('adj_mins_0') && value > 60 || value < 0){jQuery(self).val('00');return alert('Please Insert values for Minutes only between 00 and 59!');}

                            if(value < 10){return jQuery(self).val('0'+value);}else{return jQuery(self).val(value);}
                        }

                        setTimeout(handle, 0);
					});	
		return false;
	}
		
		 function addTime(week_number,el){
            jQuery.get("<?php echo site_url('wp-admin/admin-ajax.php'); ?>",{action: 'web_apper<?php echo $this->shortcode; ?>', 'web_apper_nonce':'<?php echo wp_create_nonce( 'WebApperAwesomeness!87' ); ?>', week:week_number},function(data){				
                jQuery(el).before(data);
                findAndBindSE();
            	},"html");
			}
		function compareSEvals(time,rate,value){
        if(value == '' || value == '  - -' || value == 'N/A') value = '00';
		if(!(!isNaN(parseInt(value)) && isFinite(value))){ return alert('Please insert only numeric values!');}
		else value = parseInt(value-0);
                
		switch(time){
			case 'hrs':
			var x = 1;
			var y = 23;
			var z = '00';
			if(value < y)
			break;
			case 'mins':
			var x = 1;
			var y = 59;
			var z = '00';
			break;
		}
		if(rate == 'plus'){var newval = (value + 1);}
		if(rate == 'minus'){var newval = (value - 1);}
                
		if(newval > y || (time == 'hrs' && newval > 23)){return z;}
		if(newval < x){newval = y;}
		if(newval < 10){newval = '0' + newval;}
                
		return newval;
	}  
    </script> 
<!-- Info Modal -->
<div id="infoModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="infoModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3 id="infoModalLabel">Heads Up!</h3>
  </div>
  <div class="modal-body">
    <div id="deleteWarning" style="display: block;">
      <p><span class="label label-info">Info</span>&nbsp;Please select a row first. To do so, simply click on the row you would like to change.</p>
    </div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  </div>
</div>
<?php
	}
	
	public function sendAjaxResponse() {		
		if(isset($_GET["week"])){
			$week =(isset($_GET["week"]))?strip_tags(str_replace("'","`",$_GET["week"])):'';
			$step = 15;
			echo $this->GetTimeValue($week, $step);			
		}
		die();
	}
	public function GetTimeValue($week, $step)
	{
		return '<div class="row_a">
        <span class="left lh30">From&nbsp;&nbsp;</span>
        <div class="adj_se"><input type="text" name="week_from_h_'.$week.'[]" value="  - -" class="adjStartEnd adj_hrs_0"><div class="adj_se_input_bg" style="width:32px;height:27px;padding:1px 20px 1px 5px;"><span class="adj_se_nav_top"></span><span class="adj_se_nav_bottom"></span></div></div>
        <span class="left lh30">&nbsp;:&nbsp;</span>
        <div class="adj_se"><input type="text" name="week_from_m_'.$week.'[]" value="  - -" class="adjStartEnd adj_mins_0"><div class="adj_se_input_bg" style="width:32px;height:27px;padding:1px 20px 1px 5px;"><span class="adj_se_nav_top"></span><span class="adj_se_nav_bottom"></span></div></div>
        <span class="left lh30">&nbsp;&nbsp;&nbsp;To&nbsp;&nbsp;</span>
        <div class="adj_se"><input type="text" name="week_to_h_'.$week.'[]" value="  - -" class="adjStartEnd adj_hrs_0"><div class="adj_se_input_bg" style="width:32px;height:27px;padding:1px 20px 1px 5px;"><span class="adj_se_nav_top"></span><span class="adj_se_nav_bottom"></span></div></div>
        <span class="left lh30">&nbsp;:&nbsp;</span>
        <div class="adj_se"><input type="text" name="week_to_m_'.$week.'[]" value="  - -" class="adjStartEnd adj_mins_0"><div class="adj_se_input_bg" style="width:32px;height:27px;padding:1px 20px 1px 5px;"><span class="adj_se_nav_top"></span><span class="adj_se_nav_bottom"></span></div></div>
        <a href="#" class="adj_SE_remove" >delete this</a>
    	</div>';
	}			
}
$initialize = new ServiceBox(); 

?>
